<html>
<head>
<title>Framework Doc</title>
<link rel="stylesheet" href="bootstrap-responsive.css" type="text/css" />
<link rel="stylesheet" href="bootstrap-responsive.min.css" type="text/css" />
<link rel="stylesheet" href="bootstrap.css" type="text/css" />
<link rel="stylesheet" href="bootstrap.min.css" type="text/css" />


<script
	src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"
	type="text/javascript" />
<script src="script.js" type="text/javascript" />
</head>

<body>
	<div class="navbar navbar-fixed-top">
		<div class="navbar-inner center-block">
			<div class="container span10">
				<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            		<span class="icon-bar"></span>
            		<span class="icon-bar"></span>
            		<span class="icon-bar"></span>
          		</a>
          		<a class="brand" href="/">Framework</a>
          			<div class="nav-collapse">
            			<ul class="nav">
              				<li><a href="/about">About</a></li>
            			</ul>
          			</div>
			</div>
		</div>	
	</div>
	<div class="container" id="here/">
		<div class="hero-unit">
        <h1>Welcome to our Framework </h1>
        <p>This is an explenation of how to use the implemented features of our framework.<br/>
        	In the skeleton file you will also find some example on how we made up this explanation web-page</p>
    	</div>
    	<div class="hero-unit">
        	<h2>Routing</h2>
        	<p>To set a new route you have to write in the method initDeafaultRoutes() your route 
        		using the method to add a new route routing.addRoute() passing to it a string representing the route 
        		and the method that it has to call.
        	 	<h3> Example: </h3>
        	 	<h4>
        	 		def initDefaultRoutes(): Unit = {<br/>
        	 		routing.addRoute("/NameOfRoute" , methodName)<br/>}
        	 	</h4>
        	 </p>
    	</div>
    	<div class="hero-unit">
    		<h2>Templating</h2>
    		<p>
    			To use the templating methods you should specify in your html page a division that you want to replace,
    			this division must have an id.<br />
    			After that you create an XML that you want to replace in the template in there you must specify the surround
    			tag and as attribute you must put the location of the template and the division that you want to replace.<br />
    			You set up a route, that calls the method to prepare the form, in this method you have to call the method template.setUpTemplate()
    			passing to it the path of the XML the returned NodeSequence must be passed to the prepareform() method this last returned node 
    			sequence must be write to the response.</p>
    			<h3>Example:</h3>
    			<h4>Surround Tag</h4>&#60;surround with="XMLPath" at="divID"&#62;<br/>
    			<h4>Template method</h4>
    			  def replace(req: HttpServletRequest, resp: HttpServletResponse) {<br/>
   					 val ns = template.setUpTemplate("XMLPath")<br/>
    				 val html = form.prepareForm(ns, routing)<br/>
    				resp.getWriter.write(new PrettyPrinter(72, 2).formatNodes(html))}<br/>
    			(pretty printer suggested for a nice setup of the html code)<br/>
    			}
    	</div>
    	<div class="hero-unit">
    		<h2>Forms</h2>
    		<p> You have to choice to make forms, the first is to load it from a template, we encourage you to read the paragraph about Templating if you don't have already done.
    			If you choice this possibility, remember to put the specific attribute "handler", with the name of the function and the name of the class as parameter; don't
    			put the attribute action, the framework will set up this attribute for you.<br/>
    			The other possibility is to create the tags that you need, and then create a form starting from the tags.
    			<h3>Example first possibility:</h3>
    			&lt;form handler="yourMethod(THE NAME OF YOUR CLASS)"&gt;...&lt;/form&gt;<br/>
    			
    			<h3>Example second possibility:</h3>
    			<h4>Form method</h4>
    			  def createForm {<br/>
   					 val tag: Tag = new Tag("form", List(("method", "post"), ("handler", "postComment(THE NAME OF YOUR CLASS)")), false)<br/>
    				 val tag2: Tag = new Tag("input", List(("type", "text"), ("name", "author")), true)<br/>
    				 val tag3: Tag = new Tag("textarea", List(("name", "content"), ("rows", "4"), ("cols", "50")), true)<br/>
    				 val tag4: Tag = new Tag("input", List(("type", "submit"), ("value", "Submit your comment")), true)<br/>

    				 val form = new Form(List(tag, tag2, tag3, tag4))<br/>
				     form<br/>
				    }
    		</p>
    	</div>
    	<div class="hero-unit">
    		<h2>Persistence</h2>
    		<p> We initialized an h2 relational database in order to use a database you have to know squeryl you have to define in the persistence package in the 
    			persistence class your own schema table and querys.<br/>
    			<a href="http://squeryl.org/">Squeryl website</a><br/>
    			<a href="http://www.h2database.com/">h2 website</a>
    		</p>
    	</div>
    	<div class="hero-unit">
    		<h2>Sessions</h2>
    		<p>
    			About session you can modify the duration of a session by make a little change in the method service. The initial duration of a session is 1 minute now, 
    			if you want to change it, you only need to modify the last line of the method service by providing a new number; this number correspond to the time in second.<br/>
    		</p>
    	</div>
    	<div class="hero-unit">
    		<h2>Other</h2>
    		<p>We added also some CSS files JS files from Twitter.Bootstrap in orther to build this page if you want to use the CSS you can copy the routings 
    			and methods for loading it from the Skeleton.scala file<br/>
    			<a href="http://twitter.github.com/bootstrap/index.html">Twitter Github Bootsrap</a>
    			</p>
    	</div>
	</div>
	<section>
	</section>

	<footer>
	</footer>
</body>
</html>